package com.remon.quartz.job;

import com.remon.quartz.jpush.JpushBulider;
import com.remon.quartz.util.SpringUtils;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 推送任务请求
 *
 * @author remon
 * @create 2018-08-15 18:45
 **/
public class JobPushRequest implements BaseJob {
    private static final Logger logger = LoggerFactory.getLogger(JobPushRequest.class);

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        JpushBulider jpushBulider = SpringUtils.context.getBean(JpushBulider.class);
        final JobDataMap jobDataMap = context.getJobDetail().getJobDataMap();
        // 极光标签
        final String tag = jobDataMap.getString("tag");
        // 极光标题
        final String title = jobDataMap.getString("title");
        // 极光具体参数
        final String params = jobDataMap.getString("payload");
        jpushBulider.send(tag, title, params);
    }
}
